home *** CD-ROM | disk | FTP | other *** search
- OPT PPC,NOEXE
-
- PROC RealStr(str:PTR TO CHAR,f:DOUBLE,n=1)(PTR TO CHAR)
- DEFD d
- DEFL top,rest,neg=FALSE
- DEF buf[24]:CHAR // this is large enough
- IF f<0 THEN neg:=TRUE
- d:=FAbs(f)
- top:=d
- d-=top
- IF d<0
- top--
- d++
- ENDIF
- d*=1000000000
- rest:=d
- IF f<0 THEN top:=-top
- StringF(buf,'\s\d.\z\r\d[9]',IF neg THEN '-' ELSE NIL,Abs(top),rest)
- StrCopy(str,buf,StrLen(buf)-9+n)
- ENDPROC str
-